package com.mlk.deposit.controller;

import com.mlk.core.component.page.Pager;
import com.mlk.core.util.ServerResponse;
import com.mlk.deposit.po.EngDeposit;
import com.mlk.deposit.service.EngDepositService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/eng/deposit")
public class EngDepositController {

    @Resource
    private EngDepositService engDepositService;

    /**
     * 回到暂存点首页
     *
     * @return
     */
    @RequestMapping("index")
    public String index() {
        return "deposit/deposit";
    }

    /**
     * 展示暂存点
     * @return
     */
    @ResponseBody
    @RequestMapping("listPage")
    public Pager listPage() {
        return this.engDepositService.listPage();
    }

    /**
     * 暂存点新增
     * @param bean
     * @return
     */
    @ResponseBody
    @RequestMapping("add")
    public ServerResponse add(EngDeposit bean){
        return this.engDepositService.add(bean);
    }

    /**
     * 查询所有的暂存区
     * @return
     */
    @ResponseBody
    @RequestMapping("selectAll")
    public ServerResponse selectAll(){
        return this.engDepositService.selectAll();
    }


    /**
     * 删除暂存区
     * @return
     */
    @ResponseBody
    @RequestMapping("del")
    public ServerResponse del(Integer id){
        return this.engDepositService.del(id);
    }
}
